package com.miszczu.model;
// Generated 2012-03-05 20:16:25 by Hibernate Tools 3.4.0.CR1


import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Messages generated by hbm2java
 */
@Entity
@Table(name="messages"
    ,catalog="dziennik"
)
public class Messages  implements java.io.Serializable {


     private int messageId;
     private Classes classes;
     private Users usersByToUser;
     private Users usersByFrom;
     private String messageTopic;
     private String messageBody;
     private Set<Messagesreceived> messagesreceiveds = new HashSet<Messagesreceived>(0);

    public Messages() {
    }

	
    public Messages(int messageId, Users usersByFrom, String messageTopic, String messageBody) {
        this.messageId = messageId;
        this.usersByFrom = usersByFrom;
        this.messageTopic = messageTopic;
        this.messageBody = messageBody;
    }
    public Messages(int messageId, Classes classes, Users usersByToUser, Users usersByFrom, String messageTopic, String messageBody, Set<Messagesreceived> messagesreceiveds) {
       this.messageId = messageId;
       this.classes = classes;
       this.usersByToUser = usersByToUser;
       this.usersByFrom = usersByFrom;
       this.messageTopic = messageTopic;
       this.messageBody = messageBody;
       this.messagesreceiveds = messagesreceiveds;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="message_id", unique=true, nullable=false)
    public int getMessageId() {
        return this.messageId;
    }
    
    public void setMessageId(int messageId) {
        this.messageId = messageId;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="to_class")
    public Classes getClasses() {
        return this.classes;
    }
    
    public void setClasses(Classes classes) {
        this.classes = classes;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="to_user")
    public Users getUsersByToUser() {
        return this.usersByToUser;
    }
    
    public void setUsersByToUser(Users usersByToUser) {
        this.usersByToUser = usersByToUser;
    }

@ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="from", nullable=false)
    public Users getUsersByFrom() {
        return this.usersByFrom;
    }
    
    public void setUsersByFrom(Users usersByFrom) {
        this.usersByFrom = usersByFrom;
    }

    
    @Column(name="message_topic", nullable=false, length=100)
    public String getMessageTopic() {
        return this.messageTopic;
    }
    
    public void setMessageTopic(String messageTopic) {
        this.messageTopic = messageTopic;
    }

    
    @Column(name="message_body", nullable=false, length=65535)
    public String getMessageBody() {
        return this.messageBody;
    }
    
    public void setMessageBody(String messageBody) {
        this.messageBody = messageBody;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="messages")
    public Set<Messagesreceived> getMessagesreceiveds() {
        return this.messagesreceiveds;
    }
    
    public void setMessagesreceiveds(Set<Messagesreceived> messagesreceiveds) {
        this.messagesreceiveds = messagesreceiveds;
    }




}


